import Mock from 'mockjs2'
import { builder, getBody } from '../../util'

// 条件查询出站点下的GPU
const gpuOfStationInfo = options => {
  const body = getBody(options)
  console.log('mock: body', body)
  const result = []
  for (let i = 1; i <= 5; i++) {
    result.push({
      gpuProductId: Mock.mock('@word(32)'),
      gpuProductName: 'ocs.T4.c8m' + Mock.mock('@integer(10, 99)'),
      cpuSize: Mock.mock('@integer(2, 16)'),
      memorySize: Math.floor(Math.random() * 15) > 5 ? '32' : Math.floor(Math.random() * 15) > 10 ? '64' : '128',
      gpuType: '1*NVIDIA T4',
      price: Mock.mock('@integer(10, 99)')
    })
  }
  return builder(result)
}

// 账号密码登陆
Mock.mock(/\/system\/controller\/gpuOfStationInfo/, 'post', gpuOfStationInfo)
